import { createElement, type FC } from 'react';
import classNames from 'classnames';
import Icon, { IconProps } from '../icon';
import { listIconDefaultProps } from './defaultProps';
import type { ListIconOptions } from './type';

export interface ListIconProps extends ListIconOptions, IconProps {}

const ListIcon: FC<ListIconProps> = (props) => {
  const { name, aligned, ...listIconProps } = props;

  return createElement(Icon, { name, className: classNames(aligned, { aligned }), ...listIconProps });
};

ListIcon.displayName = 'ListIcon';
ListIcon.defaultProps = listIconDefaultProps;

export default ListIcon;
